<template>
  <view class="home">
    <u-parse :content="content"></u-parse>
  </view>
</template>
<script setup>
  import { computed, onMounted, ref } from "vue";
  import { indexContent } from "../../config/api";
  const props = defineProps({
    type: {
      type: [String, Number],
      default: ''
    }
  })
  const key = computed(() => {
    if (props.type == 1) return 'score_rule'
    if (props.type == 2) return 'about_us'
    if (props.type == 3) return 'user_agreement'
    if (props.type == 4) return 'privacy_policy'
  })
  const content = ref('')
  onMounted(() => {
    _indexContent()
  })
  const _indexContent = () => {
    console.log(key.value)
    indexContent({ key: key.value }).then(res => {
      content.value = res.data.text
    })
  }
</script>
<style scoped lang="scss">
  .home {
    min-height: 100vh;
    padding: 0 30rpx;
  }
</style>